package com.ibm.cps.message.validation;

import com.fasterxml.jackson.databind.node.ObjectNode;
import com.ibm.cps.message.MessageFields;
import com.ibm.util.exception.CPSException;

public class SchemaValidator extends IProcessorValidator {

	@Override
	public void validatePostMessage(ObjectNode element) throws CPSException {
		String[] arrFields = { MessageFields.SCHEMA };
		String[] strFields = { MessageFields.SCHEMA_FORMAT_TYPE };
		ValidatorUtil.validateAllTypeFields(element, strFields, arrFields,
				null, null);
		ValidatorUtil.assignRandomIdIfNotPresent(element,
				MessageFields.SCHEMAID);

	}

	@Override
	public String getProcessorid(ObjectNode object) throws CPSException {
		return getProcessorid(object, MessageFields.SCHEMAID);
	}
}
